package normal.栈.基于链表实现的栈;

import normal.链表.ListNode;

import java.util.Arrays;

/**
 * 测试基于链表实现的栈
 *
 * @author ZhuYi
 * @create 2024/12/16 10:50
 */
public class main {
    public static void main(String[] args) {
        LinkedListStack linkedListStack = new LinkedListStack();
        linkedListStack.push(new ListNode(1));
        linkedListStack.push(new ListNode(2));
        linkedListStack.push(new ListNode(3));
        linkedListStack.push(new ListNode(4));
        linkedListStack.push(new ListNode(10));


        int peek = linkedListStack.peek();
        int pop = linkedListStack.pop();
        int size = linkedListStack.size();
        boolean empty = linkedListStack.empty();
        System.out.println(peek + " " + pop + " " + size + " " + empty);

        int[] array = linkedListStack.toArray();
        System.out.println(Arrays.toString(array));//打印栈
    }
}
